(function(){"use strict";BX.addCustomEvent(window,"BX.Landing.Block:init",(function(t){e([].slice.call(t.block.querySelectorAll("[data-source]")))}));BX.addCustomEvent("BX.Landing.Block:Node:update",(function(t){if(t.node&&t.node.hasAttribute("data-source")){e([].slice.call(t.block.querySelectorAll("[data-source]")))}}));function e(e){if(e.length){e.forEach((function(e){e=a(e);const c=e.dataset.source;const o=e.src||e.dataset.src;if(BX.Landing.Utils.Matchers.youtube.test(c)||BX.Landing.Utils.Matchers.youtube.test(o)){if(o.indexOf("autoplay=1")!==-1&&BX.Landing.getMode()!=="edit"){i(e,{autoplay:1,mute:1})}else if(e.tagName!=="IFRAME"){BX.bind(e,"click",s)}else{i(e)}}else if(BX.Landing.Utils.Matchers.vk.test(c)&&e.dataset.preview){if(o.indexOf("autoplay=1")!==-1&&BX.Landing.getMode()!=="edit"){r(e)}BX.bind(e,"click",(()=>{r(e)}))}else if(BX.Landing.Utils.Matchers.vimeo.test(c)||BX.Landing.Utils.Matchers.vine.test(c)||BX.Landing.Utils.Matchers.facebookVideos.test(c)||BX.Landing.Utils.Matchers.rutube.test(c)){n(e)}else{t(e)}}))}}function t(e){e.classList.remove("g-video-preview");e.classList.add("g-video-preview-error");e.innerHTML='<div class="g-landing-alert-v2">'+'<div class="g-landing-alert-title">'+BX.message("LANDING_VIDEO_ALERT_WRONG_SOURCE")+"</div>"+'<div class="g-landing-alert-text">'+BX.message("LANDING_VIDEO_ALERT_WRONG_SOURCE_TEXT_2")+"</div>"+"</div>"}function a(e){if(e.tagName==="IFRAME"){const t=BX.create("div",{props:{className:e.className},style:{backgroundImage:"url("+e.dataset.preview+")"},dataset:{src:e.src||e.dataset.src,source:e.dataset.source}});BX.insertBefore(t,e);BX.remove(e);return t}BX.unbind(e,"click",s);e.classList.add("g-video-preview");e.classList.remove("g-video-preview-error");e.innerHTML="";return e}function s(e){const t=e.target;i(t,{autoplay:1})}function i(e,t){const a=new BX.Loader({target:e});a.show();const s=c(e);const i=typeof t!=="undefined"&&Object.keys(t).length?t:{};i.onPlayerReadyHandler=()=>{a.hide();BX.remove(e)};BX.insertBefore(s,e);BX.Landing.MediaPlayer.Factory.create(s,i)}function r(e){const t=new BX.Loader({target:e});t.show();e.dataset.src=BX.Landing.Utils.addQueryParams(e.dataset.src,{autoplay:1});const a=c(e);a.addEventListener("load",(()=>{t.hide();BX.remove(e)}));BX.insertBefore(a,e)}function n(e){const t=new BX.Loader({target:e});t.show();const a=c(e);a.addEventListener("load",(()=>{t.hide();BX.remove(e)}));BX.insertBefore(a,e)}function c(e){if(e.tagName==="IFRAME"){return e}const t=e.className;e.classList.add("--loader");return BX.create("iframe",{props:{className:t},attrs:{src:BX.util.htmlspecialcharsback(e.dataset.src),frameborder:"0",allowfullscreen:"allowfullscreen",allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"},dataset:{src:BX.util.htmlspecialcharsback(e.dataset.src),source:BX.util.htmlspecialcharsback(e.dataset.source)}})}})();
//# sourceMappingURL=inline-video.map.js